package org.springblade.${serviceName}.controller;

<#if imports?? && imports?size gt 0>
    <#list imports as import>
import ${import};
    </#list>
</#if>
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

@RestController
@AllArgsConstructor
@RequestMapping("/${controllerPathByClassCode}")
@Tag(name = "${controllerTagName}", description = "${controllerDes!''}")
public class ${controllerClassName} extends BladeController {

<#list methods as method>
    <#if method.parameters?? && method.parameters?size gt 0>
    @Parameters({
        <#list method.parameters as parameter>
            <#if parameter.inType != "FORMDATA" && parameter.inType != "RAW">
        @Parameter(name = "${parameter.name}", description = "${parameter.description?default('')}", in = ParameterIn.${parameter.inType?upper_case}, schema = @Schema(type = "${parameter.dataType?default('String')}"))<#if parameter_has_next>,</#if>
            </#if>
        </#list>
    })
    </#if>
    @${method.methodReq}(value = "/${method.url}")
    @Operation(summary = "${method.summary?default('')}", description = "${method.description?default('')}")
    public ${method.returnParams} ${method.methodName}(<#if method.reqParamsReception?? && method.reqParamsReception?size < 1>) {${"\n"}<#else >
<#--<#list method.parameters as parameter><#if parameter.inType == "FORMDATA">        @RequestPart("${parameter.name}") ${parameter.dataType} ${parameter.name}<#elseif parameter.inType == "RAW">        @RequestBody ${parameter.dataType} ${parameter.name}<#elseif parameter.inType == "HEADER">          @RequestHeader("${parameter.name}") ${parameter.dataType?default('String')} ${parameter.name}<#elseif parameter.inType == "QUERY">        @RequestParam("${parameter.name}") ${parameter.dataType?default('String')} ${parameter.name}</#if><#if parameter_has_next>,${"\n"}</#if></#list>) {-->
<#--</#if>${"\n"}-->
<#list method.reqParamsReception as reqParams>        ${reqParams}<#if reqParams_has_next>,${"\n"}</#if></#list>) {</#if>${"\n"}
        return R.success();
    }

</#list>
}